{extend name="common@base" /}
{block name="content"}
<section class="content">
  <form class="form" method="post">
    <div class="box">
      <div class="box-body">
        <label>人员列表</label>
        <div class="form-group">
          <textarea class="form-control js-users" rows="5" readonly>{$realnames}</textarea>
        </div>
        <div class="form-group">
          <textarea name="form[uids]" class="form-control js-uids hide">{$uids}</textarea>
        </div>
      </div>
      <div class="box-footer">
        <button type="submit" class="btn btn-primary js-ajax-submit" data="">保存</button>
        <a href="javascript:history.back(-1)" class="btn btn-default ">返回</a>
      </div>
    </div>
  </form>
</section>
{/block}
{block name="page_script"}
<script>
  require(["layer_config","ajaxForm"], function (layer) {
    $("body").on("click", ".js-users", function () {
      var me = $(this), objUids = $(".js-uids"), uids = objUids.val().trim(), uidsArr = [];
      if(uids.length>0){
        uidsArr = uids.split(',');
      }
      popup_user_select({"users": uidsArr}, function (arr) {
        var names = [], uids = [];
        for (var i in arr) {
          names.push(arr[i].name);
          uids.push(arr[i].uid);
        }
        me.val(names.join(","));
        $(".js-uids").val(uids.join(","));
      });
    });
  });
</script>
{/block}


